<template>
	<view>
		<view class="img">
			<image src="../../static/login.png" mode=""></image>
		</view>
		<view class="login">
			<view class="user flex">
				<u-icon name="account" style="font-size: 50rpx;color: #82848A"></u-icon><input type="text"
					v-model="user" placeholder="请输入账号" />
			</view>
			<view class="password flex">
				<u-icon name="lock" style="font-size: 50rpx;color: #82848A;"></u-icon><input  
					v-model="password" type="password" placeholder="请输入密码">
			</view>
		</view>
		<view class="btn" @tap='login' style="color: #FFFFFF;">
			登录
		</view>
		<!-- <u-divider color="rgba(127,127,127,.8)" style="font-size: 30rpx;">快速登录</u-divider>
		<view class="wxlogin">
			<svg t="1624066444276" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
				p-id="3188" width="48" height="48">
				<path
					d="M337.387283 341.82659c-17.757225 0-35.514451 11.83815-35.514451 29.595375s17.757225 29.595376 35.514451 29.595376 29.595376-11.83815 29.595376-29.595376c0-18.49711-11.83815-29.595376-29.595376-29.595375zM577.849711 513.479769c-11.83815 0-22.936416 12.578035-22.936416 23.6763 0 12.578035 11.83815 23.676301 22.936416 23.676301 17.757225 0 29.595376-11.83815 29.595376-23.676301s-11.83815-23.676301-29.595376-23.6763zM501.641618 401.017341c17.757225 0 29.595376-12.578035 29.595376-29.595376 0-17.757225-11.83815-29.595376-29.595376-29.595375s-35.514451 11.83815-35.51445 29.595375 17.757225 29.595376 35.51445 29.595376zM706.589595 513.479769c-11.83815 0-22.936416 12.578035-22.936416 23.6763 0 12.578035 11.83815 23.676301 22.936416 23.676301 17.757225 0 29.595376-11.83815 29.595376-23.676301s-11.83815-23.676301-29.595376-23.6763z"
					fill="#28C445" p-id="3189"></path>
				<path
					d="M510.520231 2.959538C228.624277 2.959538 0 231.583815 0 513.479769s228.624277 510.520231 510.520231 510.520231 510.520231-228.624277 510.520231-510.520231-228.624277-510.520231-510.520231-510.520231zM413.595376 644.439306c-29.595376 0-53.271676-5.919075-81.387284-12.578034l-81.387283 41.433526 22.936416-71.768786c-58.450867-41.433526-93.965318-95.445087-93.965317-159.815029 0-113.202312 105.803468-201.988439 233.803468-201.98844 114.682081 0 216.046243 71.028902 236.023121 166.473989-7.398844-0.739884-14.797688-1.479769-22.196532-1.479769-110.982659 1.479769-198.289017 85.086705-198.289017 188.67052 0 17.017341 2.959538 33.294798 7.398844 49.572255-7.398844 0.739884-15.537572 1.479769-22.936416 1.479768z m346.265896 82.867052l17.757225 59.190752-63.630058-35.514451c-22.936416 5.919075-46.612717 11.83815-70.289017 11.83815-111.722543 0-199.768786-76.947977-199.768786-172.393063-0.739884-94.705202 87.306358-171.653179 198.289017-171.65318 105.803468 0 199.028902 77.687861 199.028902 172.393064 0 53.271676-34.774566 100.624277-81.387283 136.138728z"
					fill="#28C445" p-id="3190"></path>
			</svg>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: 'admin',
				password: '123456'
			};
		},
		methods: {
			login(){
				uni.request({
					url:"https://open.ys7.com/api/lapp/token/get",
					method:"post",
					dataType:"json",
					header: { 
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data:{
						appKey:getApp().globalData.AppKey,
						appSecret:getApp().globalData.Secret
					},
					success: (res) => {
						console.log(res)
						if(res.data.code == '200'){
							uni.setStorageSync("accessToken",res.data.data.accessToken)
							uni.switchTab({
								url:'/pages/index/index',
								fail: (err) => {
									console.log(err)
								}
							})
						}
						
						
					}
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.img {
		text-align: center;
		transform: scale(.7);
	}

	.login {
		// border: 1px solid;
		width: 70%;
		margin: auto;
	}

	.flex {
		display: flex;
		padding: 30rpx 0;
		align-items: center;

		input {
			margin-left: 20rpx;
		}
	}

	.user {
		border-top: 1px solid rgba($color: gray, $alpha: .2);
		border-bottom: 1px solid rgba($color: gray, $alpha: .2);
	}

	.password {
		border-bottom: 1px solid rgba($color: gray, $alpha: .2);
	}

	.btn {
		width: 70%;
		margin: 100rpx auto;
		text-align: center;
		font-size: 32rpx;
		border-radius: 50rpx;
		background-image: linear-gradient(to bottom, rgb(176, 226, 248), rgb(112, 146, 251));
		padding: 20rpx 0;
		color: #fff;
		color: rgb(80,152,254);

	}

	.wxlogin {
		text-align: center;
		margin: 50rpx 0;
	}
</style>
